home *** CD-ROM | disk | FTP | other *** search
/ HTBasic 9.3 / HTBasic 9.3.iso / LgcyPlus / disk2 / OVENCONT._ / OVENCONT.
Encoding:
Text File  |  2001-03-02  |  1.8 KB  |  57 lines

  1. 10    ! ************************************************************
  2. 20    ! Example: Oven Control
  3. 30    !
  4. 40    ! This program creates a METER widget and a SCROLLBAR widget.
  5. 50    ! As you set the SCROLLBAR bar, the associated value is
  6. 60    ! displayed on the METER widget. Note that the SCROLLBAR
  7. 70    ! value increases as the bar is moved from top to bottom.
  8. 80    !
  9. 90    ! ************************************************************
  10. 100   !
  11. 110   COM INTEGER Count,REAL Setpt
  12. 120   !
  13. 130   ! Create the widgets
  14. 140   !
  15. 150   ASSIGN @Main TO WIDGET "PANEL"
  16. 160   CONTROL @Main;SET ("X":100,"Y":50,"WIDTH":250,"HEIGHT":200)
  17. 170   CONTROL @Main;SET ("TITLE":" Example: Oven Control")
  18. 180   CONTROL @Main;SET ("SYSTEM MENU":"Quit")
  19. 190   !
  20. 200   ASSIGN @Disp1 TO WIDGET "METER";PARENT @Main
  21. 210   CONTROL @Disp1;SET ("X":5,"Y":5,"WIDTH":150,"HEIGHT":150)
  22. 220   CONTROL @Disp1;SET ("BACKGROUND":1)
  23. 230   !
  24. 240   ASSIGN @Inp TO WIDGET "SCROLLBAR";PARENT @Main
  25. 250   CONTROL @Inp;SET ("X":190,"Y":5,"WIDTH":20,"HEIGHT":150)
  26. 260   !
  27. 270   ! Set up the EVENT handlers
  28. 280   !
  29. 290   ON EVENT @Main,"SYSTEM MENU" GOTO Finis
  30. 300   ON EVENT @Inp,"DONE" GOSUB Serviceinp
  31. 310   ON EVENT @Inp,"CHANGED" GOSUB Serviceinp
  32. 320   !
  33. 330   ! Generate values
  34. 340   !
  35. 350   Setpt=50
  36. 360   Curtemp=0
  37. 370   Siz=2
  38. 380   !
  39. 390   CONTROL @Inp;SET ("VALUE":Setpt)
  40. 400   GOSUB Serviceinp
  41. 410   LOOP
  42. 420     Diff=Setpt-Curtemp
  43. 430     Noise=Siz*(RND-.5)*2
  44. 440     Delta=Diff/10+Noise
  45. 450     Curtemp=Curtemp+Delta
  46. 460     CONTROL @Disp1;SET ("VALUE":Curtemp)
  47. 470   END LOOP
  48. 480   !
  49. 490 Serviceinp:   !
  50. 500   STATUS @Inp;RETURN ("VALUE":Setpt)
  51. 510   Setpt=INT(Setpt)
  52. 520   RETURN
  53. 530   !
  54. 540 Finis:   !
  55. 550   ASSIGN @Main TO *         ! Delete PANEL widget
  56. 560   END
  57.